<template>
  <div class="tcr-total">
    <div>
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item>首页</el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/' }">收藏课程</el-breadcrumb-item>
        <el-breadcrumb-item></el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="tcr-cont">
      <table class="tab">
        <th class="tabheader">课程名</th>
        <th>教师</th>
        <th>教师级别</th>
        <tr class="tabbody" v-for="col in tabledata" :key="col.item">
          <td class="tabcont">{{col.coursename}}</td>
          <td>{{col.teachername}}</td>
          <td>{{col.teachertc}}</td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  props: {
    username: {
      type: String,
      default: ''
    },
  },
  data() {
    return {
      tabledata: [],
    }
  },
  created() {
    const that = this
    that.selectcollectcourse()
  },
  methods: {
    //查询收藏课程信息
    async selectcollectcourse() {
      const that = this
      const {data:res} = await axios.get(
        'http://localhost:81/checkCode/selectColCou',{
          params:{
            username: that.username
          }
        }
      )
      console.log("查到收藏课程相关信息",res);
      that.tabledata = res.data
    },
  },
}
</script>

<style lang="less" scoped>
.tcr-total {
  margin-left: 100px;
  margin-top: -120px;
  .tcr-cont {
    width: 1200px;
    height: 600px;
    margin-left: 250px;
    margin-top: 100px;
    .tab {
      width: 1000px;
      .tabbody {
        text-align: center;
        font-size: 18px;
      }
    }
  }
}
</style>
